#ifndef G3_LUA_PARTICLE_SYS_H
#define G3_LUA_PARTICLE_SYS_H

#include <string>

#include "res/res_texture.h"
#include "lua_handler.h"
#include "math/m_vector.h"

#include "color.h"

using namespace G3;

int tolua_particlescript_open (lua_State *LuaState);

//==============================================================================
// Only for the Lua binding
//==============================================================================
extern int G3PS_NumMaxParticles;
extern int G3PS_NumToRelease;
extern float G3PS_ReleaseInterval;
extern float G3PS_LifeCycle;
extern float G3PS_Size;
extern float G3PS_Mass;
extern COL4F G3PS_Color;
extern VEC3F G3PS_Position;
extern VEC3F G3PS_Velocity;
extern VEC3F G3PS_Gravity;
extern bool G3PS_AirResistence;
extern float G3PS_VelocityVar;
extern TEXTURE_FILTER G3PS_Filter;
extern std::string G3PS_BitmapFile;

static void PS_SetColor (float aR = 1.0f, float aG = 1.0f, float aB = 1.0f, float aA = 1.0f) {
	G3PS_Color.r = aR;
	G3PS_Color.g = aG;
	G3PS_Color.b = aB;
	G3PS_Color.a = aA;
}

static void PS_SetPosition (float aX = 0.0f, float aY = 0.0f, float aZ = 0.0f) {
	G3PS_Position.x = aX;
	G3PS_Position.y = aY;
	G3PS_Position.z = aZ;
}

static void PS_SetVelocity (float aX = 0.0f, float aY = 0.0f, float aZ = 0.0f) {
	G3PS_Velocity.x = aX;
	G3PS_Velocity.y = aY;
	G3PS_Velocity.z = aZ;
}

static void PS_SetGravity (float aX = 0.0f, float aY = 0.0f, float aZ = 0.0f) {
	G3PS_Gravity.x = aX;
	G3PS_Gravity.y = aY;
	G3PS_Gravity.z = aZ;
}

static void PS_SetBitmap (const char *aFilename) {
	Assert (aFilename, "PS_SetBitmap: Filename argument is a NULL pointer");

	G3PS_BitmapFile = (std::string) aFilename;
}

#endif

